﻿using CommonUtils.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace ScanFile.Model{

  [DBTable("fileEx")]
  public class FileEx {

		private System.String _fileName;
    [DBColumn("fileName")]
    [Description("文件名称"), CategoryAttribute("文件信息"), DisplayName("文件名"),ReadOnlyAttribute(false)]
    public System.String FileName{
			get{ return _fileName; }
			set{ _fileName = value; }
		}

    [BrowsableAttribute(false)]
    public System.String DisplayName {
      get {
        return _fileName;
      }
    }

    private System.String _extension;
    [DBColumn("extension")]
    [Description("文件扩展名"), DisplayName("扩展名"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    public System.String Extension{
			get{ return _extension; }
			set{ _extension = value; }
		}

		private System.String _md5;
    [DBColumn("md5")]
    [Description("文件MD5值"), DisplayName("MD5"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    public System.String Md5{
			get{ return _md5; }
			set{ _md5 = value; }
		}

		private System.String _diskLabel;
    [DBColumn("diskLabel")]
    [Description("文件所在磁盘盘符"), DisplayName("磁盘"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    public System.String DiskLabel{
			get{ return _diskLabel; }
			set{ _diskLabel = value; }
		}

		private System.String _diskNumber;
    [DBColumn("diskNumber")]
    [Description("文件所在磁盘序列号"), DisplayName("磁盘号"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    public System.String DiskNumber{
			get{ return _diskNumber; }
			set{ _diskNumber = value; }
		}

		private System.String _folderFullName;
    [DBColumn("folderFullName")]
    [Description("文件夹全路径"), DisplayName("路径"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    public System.String FolderFullName{
			get{ return _folderFullName; }
			set{ _folderFullName = value; }
		}


    private System.String _pathMd5;
    [DBColumn("pathMd5", true)]
    [BrowsableAttribute(false)]
    public System.String PathMd5 {
      get {
        return _pathMd5;
      }
      set {
        _pathMd5 = value;
      }
    }


    private System.String _folderMd5;
    [DBColumn("folderMd5", true)]
    [BrowsableAttribute(false)]
    public System.String FolderMd5 {
      get {
        return _folderMd5;
      }
      set {
        _folderMd5 = value;
      }
    }

    

    private System.String _fullName;
    [DBColumn("fullName", true)]
    [Description("文件全路径"), DisplayName("全路径"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    public System.String FullName{
			get{ return _fullName; }
			set{ _fullName = value; }
		}

		private System.String _creationTime;
    [Description("文件创建时间"), DisplayName("创建时间"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    [DBColumn("creationTime")]
    public System.String CreationTime{
			get{ return _creationTime; }
			set{ _creationTime = value; }
		}

		private System.String _lastAccessTime;
    [DBColumn("lastAccessTime")]
    [Description("文件最后访问时间"), DisplayName("最后访问"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    public System.String LastAccessTime{
			get{ return _lastAccessTime; }
			set{ _lastAccessTime = value; }
		}

		private System.String _lastWriteTime;
    [DBColumn("lastWriteTime")]
    [Description("文件上次修改时间"), DisplayName("修改时间"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    public System.String LastWriteTime{
			get{ return _lastWriteTime; }
			set{ _lastWriteTime = value; }
		}

		private System.Int64 _fileSize;
    [DBColumn("fileSize")]
    [BrowsableAttribute(false)]
    public System.Int64 FileSize{
			get{ return _fileSize; }
			set{ _fileSize = value; }
		}

    /// <summary>
    /// 计算文件大小函数(保留两位小数),Size为字节大小
    /// </summary>
    /// <param name="Size">初始文件大小</param>
    /// <returns></returns>
    public static string CountSize(long Size) {
      string m_strSize = "";
      long FactSize = 0;
      FactSize = Size;
      if (FactSize < 1024.00)
        m_strSize = FactSize.ToString("F2") + " Byte";
      else if (FactSize >= 1024.00 && FactSize < 1048576)
        m_strSize = (FactSize / 1024.00).ToString("F2") + " K";
      else if (FactSize >= 1048576 && FactSize < 1073741824)
        m_strSize = (FactSize / 1024.00 / 1024.00).ToString("F2") + " M";
      else if (FactSize >= 1073741824)
        m_strSize = (FactSize / 1024.00 / 1024.00 / 1024.00).ToString("F2") + " G";
      return m_strSize;
    }

    [Description("文件大小，单位B"), DisplayName("大小"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    public System.String DisplayFileSize {
      get {
        return CountSize(_fileSize);
      }
      set {

      }
    }


    private System.Int64 _sameFileCount;
    [Description("重复文件数"), DisplayName("数量"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    [DBColumn("sameFileCount")]
    public System.Int64 SameFileCount {
      get {
        return _sameFileCount;
      }
      set {
        _sameFileCount = value;
      }
    }
    


    private System.String _recordTime;
    [DBColumn("recordTime")]
    [BrowsableAttribute(false)]
    public System.String RecordTime{
			get{ return _recordTime; }
			set{ _recordTime = value; }
		}

		private System.String _scanTime;
    [Description("扫描文件的时间"), DisplayName("扫描时间"), CategoryAttribute("文件信息"), ReadOnlyAttribute(false)]
    [DBColumn("scanTime")]
    public System.String ScanTime{
			get{ return _scanTime; }
			set{ _scanTime = value; }
		}
	}
}
